#include <bits/stdc++.h>
using namespace std;

#define debug printf("#@$@%\n")
const int mac = 5e5 + 10;

char s[mac];
vector<int>g[mac];
int cnt = 0, dp[mac][3];
int dp2[mac][3];

int dfs_wedge(char *s, int fa) {
	if (!s[0])
		return 0;
	int nb = 1;
	cnt++;
	if (fa != -1) {
		g[cnt].push_back(fa);
		g[fa].push_back(cnt);
	}
	if (s[0] == '0')
		return nb;
	int u = cnt;
	nb += dfs_wedge(s + 1, u);
	if (s[0] == '2')
		nb += dfs_wedge(s + nb, u);
	return nb;
}

void dfs(int u, int fa) {
	int v1 = 0, v2 = 0;
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i];
		if (v == fa)
			continue;
		dfs(v, u);
		dp[u][1] += dp[v][0];
		dp2[u][1] += dp2[v][0];
		if (v1)
			v2 = v;
		else
			v1 = v;
	}
	dp[u][1]++;
	dp2[u][1]++;
	if (v2) {
		dp2[u][0] = min(dp2[v1][1] + dp2[v2][0], dp2[v1][0] + dp2[v2][1]);
		dp[u][0] = max(dp[v1][0] + dp[v2][0], max(dp[v1][0] + dp[v2][1], dp[v1][1] + dp[v2][0]));
	} else if (v1)
		dp[u][0] = max(dp[v1][0], dp[v1][1]), dp2[u][0] = min(dp2[v1][0], dp2[v1][1]);
}

int main(int argc, char const *argv[]) {
	scanf ("%s", s + 1);
	if (s[1] == '0') {
		printf("%d %d\n", 1, 0);
		return 0;
	}
	dfs_wedge(s + 1, -1);
	int n = strlen(s + 1);
	dfs(1, -1);
	printf("%d %d\n", max(dp[1][0], dp[1][1]), min(dp2[1][0], dp2[1][1]));
	return 0;
}
